package com.Ajava1704.for设计模式.for动态代理.Jdk动态代理;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 作者: LCG
 * 日期: 2020/2/14 08:54
 * 描述:
 */
public class ForMyInvocationHandler2<T> implements InvocationHandler {

    private T t;

    public ForMyInvocationHandler2(T t) {
        this.t = t;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("+===向数据库写日志===");
        Object invoke = method.invoke(t, args);
        System.out.println("=====向Rabbitmq发一条消息=====");
        return invoke;
    }
}
